<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Preferences - Swing &gt; Code Generation</title>
<link href="../../book.css" rel="stylesheet" type="text/css">
</head>

<body><h1>Swing Code Generation</h1>
<table border="0" width="800" cellspacing="0" cellpadding="5">
	<tr>
		<td colspan="2"><b>Swing Designer</b> supports a wide variety of code generation styles 
		and can emulate most other Java GUI builders including NetBeans, 
		JBuilder, the Eclipse Visual Editor, etc. Choose a <b>
		<a href="#Variable">Variable 
		Generation</a></b> style (<b><a href="#Local">Local</a></b>, <b>
		<a href="#Field">Field</a></b>, <b><a href="#InitializedField">Initialized Field</a></b> or <b>
		<a href="#Lazy">Lazy</a></b>) and a <b><a href="#Statement">Statement Generation</a></b> style (<b><a href="#Flat">Flat</a></b> or <b>
		<a href="#Block">Block</a></b>). Many of the styles have additional options that can be set. 
		Once any combination of settings is selected, you can see a preview of 
		that code generation style in the <b>Preview</b> pane.
		<img src="../preferences/swing/images/code_generation_method_name.gif" align="right" hspace="10" vspace="10"><p>
		You can also specify in which method components will be created by default 
		(in the event that a suitable method has not already be 
		defined for the current class). If the method does not exist, it will be 
		created and a call to it added to the constructor for the class. Various 
		default choices are provided to match the code generation patterns of 
		other GUI builders.<h2>
		<a name="Variable">Variable</a> 
		generation</h2>
      <p><b>Swing Designer</b> supports several <b>Variable Generation</b> 
		styles including <b><a href="#Local">Local</a></b>, <b><a href="#Field">Field</a></b>, <b>
		<a href="#InitializedField">Initialized Field</a></b> or <b>
		<a href="#Lazy">Lazy</a></b>.</td>
	</tr>
	<tr>
		<td align="left" width="100%" colspan="2">
		<h3><a name="Local">Local</a> Variable Mode</h3>
		<p>
		<img src="../preferences/swing/images/code_generation_local.gif" hspace="0"><p>
		In the <b>Local</b> variable generation style, each component is 
		assigned to a unique local variable and initialized at the point of 
		declaration. An option is provided to declare each variable as <b>final</b>. 
		Note that component types marked as <b>As Field</b> on the <b>
		<a href="../preferences/swing/preferences_variables.html#TypeSpecific">Variables &gt; Type 
		Specific</a></b> preference page will always be assigned to fields.</td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>Local 
				Variables / Flat Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_local_source.gif" hspace="0" align="top"></td>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>Final Local 
				Variables / Flat Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_local_source_final.gif" hspace="0" align="top"></td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>Local 
				Variables / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_local_source_block.gif" hspace="0"></td>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>Final Local 
				Variables / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_local_source_final_block.gif" hspace="0" width="323" height="192"></td>
	</tr>
	<tr>
		<td align="left" width="100%" colspan="2">
		<h3><a name="Field">Field</a> Mode</h3>
		<p>
		<img src="../preferences/swing/images/code_generation_field.gif" hspace="0"><p>
		In the <b>Field</b> generation style, each component is 
		assigned to a unique field and initialized at the point where it is 
		first used. An option is provided to prefix each field reference with <b>
		this</b>.</td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>Fields / Flat Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_field_source.gif" hspace="0" align="top" width="317" height="171"></td>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>This 
		Fields / Flat Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_field_source_this.gif" hspace="0" align="top" width="339" height="171"></td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>Fields / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_field_source_block.gif" hspace="0" width="329" height="222"></td>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>This 
		Fields / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_field_source_this_block.gif" hspace="0" width="349" height="221"></td>
	</tr>
	<tr>
		<td align="left" width="100%" colspan="2">
		<h3><a name="InitializedField">Initialized Field</a> Mode</h3>
		<p>
		<img src="../preferences/swing/images/code_generation_int_field.gif" hspace="0" width="298" height="98"><p>
		In the <b>Initialized Field</b> generation style, each component is 
		assigned to a unique field and initialized at the point at the point of 
		declaration. An option is provided to prefix each field reference with
		<b>this</b>.</td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>
		Initialized Fields / Flat Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_int_field_source.gif" hspace="0" align="top" width="316" height="143"></td>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>
		Initialized This Fields / Flat Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_int_field_source_this.gif" hspace="0" align="top" width="341" height="143"></td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>
		Initialized Fields / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_int_field_source_block.gif" hspace="0" width="353" height="193"></td>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>
		Initialized This Fields / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_int_field_source_this_block.gif" hspace="0" width="352" height="193"></td>
	</tr>
	<tr>
		<td align="left" width="100%" colspan="2">
		<h3><a name="Lazy">Lazy</a> Mode</h3>
		<p>
		<img src="../preferences/swing/images/code_generation_lazy.gif" hspace="0" width="298" height="158"><p>
		In the <b>Lazy</b> generation style, each component is created in its 
		own unique <b>getXXX()</b> method. An option is provided to set the 
		visibility modifier to <b>private</b>, <b>package private</b>, <b>
		protected</b> or <b>public</b>.</td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>Lazy 
		Private Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_lazy_source.gif" hspace="0" align="top" width="346" height="307"></td>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>Lazy 
		Public Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_lazy_source_public.gif" hspace="0" align="top" width="337" height="298"></td>
	</tr>
	<tr>
		<td align="left" width="100%" valign="top" colspan="2"><h2>
		<a name="Statement">Statement</a> 
		generation</h2>
      <p><b>Swing Designer</b> supports <b>flat</b> mode and <b>block</b> mode 
		generation modes.</td>
	</tr>
	<tr>
		<td align="left" width="50%" valign="top">
		<h3><a name="Flat">Flat</a> Mode</h3>
		<p>
		<img src="../preferences/swing/images/code_generation_flat.gif" hspace="0" width="298" height="147"></p>
		<p>In <b>flat</b> mode, each component is created in the same scope at 
		the same indentation level. An option is provided to prefix the creation 
		of each component with either a blank line or a comment.</td>
		<td align="left" width="50%" valign="top">
		<h3><a name="Block">Block</a> Mode</h3>
		<p>
		<img src="../preferences/swing/images/code_generation_block.gif" hspace="0" width="298" height="147"></p>
		<p>In <b>block</b> mode, each component is created in its own scoped 
		code block. Child components are created in nested blocks.</td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>Local 
				Variables / Flat Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_local_source.gif" hspace="0" align="top"></td>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>Local 
				Variables / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_local_source_block.gif" hspace="0"></td>
	</tr>
	<tr>
		<td align="center" width="50%" bgcolor="#FCFCF4" valign="top"><b>Fields / Flat Mode<br>
				</b>
		<img src="../preferences/swing/images/code_generation_field_source.gif" hspace="0" align="top" width="317" height="171"></td>
		<td align="center" width="50%" bgcolor="#F2F2E6" valign="top"><b>Fields / Block Mode<br>
				</b>
				<img src="../preferences/swing/images/code_generation_field_source_block.gif" hspace="0" width="329" height="222"></td>
	</tr>
	</table>

</body></html>